#ifndef _ROB_SENSORSHIELD_H
#define _ROB_SENSORSHIELD_H

#include <WProgram.h>
#include <avr/io.h>


// shield controller i2c address
#define I2C_SENSORSHIELD_ADR 0x40 //>> 1  // Address of i2c irbar shield driver

#define I2C_SENSORSHIELD_ACK_LEN 8 // expect 8 bytes of sensor data


// shiled control command bits
#define I2C_CMD_PING_ENABLE    0x01
#define I2C_CMD_IRBAR_ENABLE   0x02
#define I2C_CMD_LIGHT2_ENABLE  0x04
#define I2C_CMD_LIGHT1_ENABLE  0x08
#define I2C_CMD_SOUND_PLAY1    0x10
#define I2C_CMD_SOUND_PLAY2    0x20
#define I2C_CMD_SOUND_PLAY3    0x40



class CSensorShield {
public:
  void Begin(void);
  uint8_t update(void);
  uint8_t requestSensors(void);

private:
  uint8_t _lastLight;
  uint8_t _lastSound;
  uint8_t _lastPingEnable;
  uint8_t _lastIrBarEnable;
  uint8_t _i2cCmd[2];
  void createI2cCmd(void);

};


extern CSensorShield Sensorshield;








#endif // _ROB_SENSORSHIELD_H

